<%= basic_form(user) do |f|
  spec = {
    :fields => [{
      :col => :name,
      :label => "Full Name",
      :required => true,
      :value => f.text_field(:name),
      :details => "The user's full name. Example: 'John Doe' or 'Team 1.1'"
    },{
      :col => :login,
      :label => "Login Name",
      :required => true,
      :value => f.text_field(:login) + " " + button_to_function("Suggest", "suggest_login(this)"),
      :details => "The login name will be used to log in. Click the suggest button to suggest a login name."
    },{
      :col => :role,
      :required => true,
      :value => f.select(:role_id, Role.select_options, :include_blank => true)
    },{
      :col => :email,
      :value => f.text_field(:email)
    },{
      :col => :phone,
      :label => "Main Phone",
      :value => f.text_field(:phone, :size => 20),
      :details => "Phone number should include the country code. Example: +25680344523"
    },{
      :col => :phone2,
      :label => "Alternate Phone",
      :value => f.text_field(:phone2, :size => 20),
      :details => "Phone number should include the country code. Example: +25680344523"
    },{
      :col => :language,
      :required => true,
      :value => f.select(:language_id, Language.select_options),
      :details => "This will primarily affect the language of forms for observers."
    },{
      :col => :active?,
      :value => f.check_box(:active),
      :details => "Is this user active in the mission? If this box is not checked, the
        user will not be able to log in or submit forms."
    },{
      :col => :notes,
      :value => f.text_area(:notes),
    }]
  }
  if user == current_user
    spec[:fields] += [{
      :col => :password,
      :value => f.password_field(:password),
      :details => "Enter a new password here if you'd like to change your existing password."
    },{
      :col => :password_confirmation,
      :value => f.password_field(:password_confirmation),
      :details => "Enter the new password again."
    }]
  end
  if user != current_user
    prefix = user.new_record? ? "" : "Reset password and "
    verb = user.new_record? ? "choose" : "reset"
    spec[:fields] << {
      :col => :reset_password_method,
      :label => user.new_record? ? "Password Creation" : "Reset Password?",
      :value => 
        (user.new_record? ? "" : f.radio_button(:reset_password_method, "dont") + " Leave password alone<br/>".html_safe) + 
        f.radio_button(:reset_password_method, "email") + " " + "#{prefix}send email instructions<br/>".capitalize.html_safe +
        f.radio_button(:reset_password_method, "print") + " " + "#{prefix}show printable instructions".capitalize.html_safe,
      :details => (user.new_record? ? 
          "Choose how this user should get his/her password. " :
          "Choose whether and how to reset this user's password. ") +
        "The system can either send him/her " +
        "an email with instructions on how to #{verb} the password online, or the system display a printable " +
        "instruction sheet including a randomly generated password." 
    }
  end
  spec
end
%>
<br/>